package com.yuantu.judiciary.test.test;

import com.alibaba.fastjson2.JSON;
import com.yuantu.judiciary.model.domain.QueryEntityDO;
import com.yuantu.judiciary.model.dto.ResBadRecordDTO;
import com.yuantu.judiciary.model.dto.SearchRecordContentDTO;
import com.yuantu.judiciary.model.enums.QueryType;
import com.yuantu.judiciary.model.enums.SearchType;
import com.yuantu.judiciary.service.ICheckResultService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 风险报告查询
 */
@Service
public class Risk {

    @Autowired
    private ICheckResultService checkResultService;

//    @PostConstruct
    public void testRiskFunctionality() {
        Long userId = 1L;
        QueryType queryType = QueryType.PER_BAD_RECORD;
        SearchRecordContentDTO searchRecord = new SearchRecordContentDTO("王俊", "320106198012061615");

        QueryEntityDO entity = new QueryEntityDO("王俊", "320106198012061615", SearchType.PERSON);
        entity.setId(901L);

        //不良记录风险等级
        String badRecordStr = checkResultService.getJsonDataProd(userId, QueryType.PER_BAD_RECORD, searchRecord, entity);
        if (StringUtils.isNotBlank(badRecordStr)) {
            List<ResBadRecordDTO> data = JSON.parseArray(badRecordStr, ResBadRecordDTO.class);
            ResBadRecordDTO personResult = data.get(0);
            System.out.println(data);
        }
    }

}
